
/**
 * topromise(fn,arg1,arg2)
 * @param {*} fn 
 * @returns 
 */
module.exports = function (fn) {
  const _this = this;
  let result = "";
  return new Promise((resolve, reject) => {
    const args = Array.prototype.slice.call(arguments, 1);
    try {
      if (typeof fn === "function") result = fn.apply(_this, args);
      resolve(result);
    } catch (err) {
      reject(err);
    }
  });
};
